package com.x.ioc_04;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * ClassName: javaBean
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.09.03 14:26
 */


@Component
@Getter
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON)
public class javaClass {

    private String name ="111";

    //使用Value注解读取配置文件
    //若没有配置文件，默认值为冒号后内容 (admin)
    @Value("${jdbc.username:admin}")
    private String username;

    @Value("${jdbc.password:admin}")
    private String password;

}
